﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.Security;
using DTOSingTowerMall;
using FacadeSingTowerMall;

namespace WebFormSingTowerMall.HallBooking
{
    public partial class MemberDetails : HallBookingBaseController
    {
        MembershipUser CurrentUser;
        UserAccountFacade AcctFacade;
        IUserDetail userDetail;
        protected override void Page_Load(object sender, EventArgs e)
        {
            base.Page_Load(sender, e);
            currentPage = "MemberDetails.aspx";
            CurrentUser = Membership.GetUser(HttpContext.Current.User.Identity.Name);
            AcctFacade = new UserAccountFacade();

            if (!IsPostBack)
            {
                userDetail = AcctFacade.GetUserDetail((Guid)CurrentUser.ProviderUserKey);
                if (userDetail != null)
                {
                    fullNameTxtBx.Text = userDetail.FullName;
                    contactNoTxtBx.Text = userDetail.ContactNo;
                }
            }

        }

        protected void Submit_btn_Click(object sender, EventArgs e)
        {
            bookingDetails.userName = CurrentUser.UserName;
            bookingDetails.identityNo = nricTxtBx.Text;
            bookingDetails.cmpnyName = cmpnyNameTxtBx.Text;            
            bookingDetails.cmpnyAddress = TextBox1.Text;
            
            NextPage();
        }
    }
}